﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Master.Master" Inherits="System.Web.Mvc.ViewPage<GuestBookViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="quick">
        <% Html.RenderPartial("StepByStep"); %>
    </div>
    <div style="margin: 5px;">
        <div class="gb_box">
            <ul>
                <% foreach (EGuestBook item in Model.GuestBookList) { %>
                <li>
                    <div class="gb_title">
                        <%=item.NickName %>
                        -
                        <%=item.Email %>
                        -
                        <%=item.AddDate %>
                        <div class="floatRight">
                            <%=Html.ActionLink("删除", "Delete", new { gbid = item.GuestBookId }, new { @class = "d" })%>
                            <%=Html.ActionLink("回复", "Replay", null, new { @class = "r", id = item.GuestBookId }) %>
                        </div>
                    </div>
                    <div class="gb_content">
                        <%=item.Content %>
                        <% if (!string.IsNullOrEmpty(item.ReContent)) { %>
                        <div class="gb_re">
                            管理员回复:
                            <br />
                            <%=item.ReContent %>
                        </div>
                        <% } %>
                    </div>
                </li>
                <% } %>
            </ul>
        </div>
        <div class="gb_add">
            <% using (Html.BeginForm("Edit", "GuestBook", FormMethod.Post)) { %>
            <input type="hidden" name="gbid" value="" />
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td colspan="2">
                        <%=Html.TextArea("tbrecontent")%>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" name="btnsumbit" value="<%=ViewsResources.Shared.Submit %>" />
                    </td>
                </tr>
            </table>
            <% } %>
        </div>
        <br />
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <%= HtmlMetaHelper.HtmlTitle(ViewsResources.Shared.Guestbook)%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
    <style type="text/css">
        .gb_box
        {
            border: solid 2px #e5e5e5;
            border-bottom: none;
            margin-bottom: 10px;
        }
        .gb_box ul li
        {
            border-bottom: 2px solid #e5e5e5;
            padding: 15px;
        }
        .gb_title
        {
            font-family: Georgia;
            font-size: 14px;
            padding: 5px;
            border-bottom: 1px dotted #ccc;
        }
        .gb_title a
        {
            display: block;
            float: right;
            padding: 3px;
            font-size: 12px;
        }
        .gb_content
        {
            padding: 10px;
            line-height: 2em;
        }
        .gb_alter
        {
            background-color: #f7f7f7;
        }
        .gb_re
        {
            padding: 10px;
            line-height: 2em;
            color: Red;
            border: 1px solid #ccc;
        }
        .gb_add table
        {
            width: 500px;
        }
        .gb_add table td
        {
            padding: 5px;
        }
        .gb_add table td.t
        {
            width: 50px;
        }
        .gb_add table td textarea
        {
            width: 100%;
            height: 150px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $("div.gb_box ul li:odd").addClass("gb_alter");
            $("div.gb_add").dialog({ autoOpen: false,
                title: "<%=ViewsResources.Shared.Guestbook %>",
                width: 520, height: 250, closeText: "X", modal: true
            });
            $(".gb_title a.d").click(function () { return confirm("确定删除吗?"); });
            $(".gb_title a.r").click(function () {
                $("div.gb_add").dialog("open");
                var id = $(this).attr("id");
                $.post('<%=Url.Action("Replay", new { gbid = "-id-" })%>'.replace(/-id-/ig, id), function (m) {
                    $("div.gb_add").find("textarea").val(m).end().find(":hidden").val(id);
                });
                return false;
            });
            $("form").submit(function () {
                var flag = true;
                $("textarea,input").each(function () { if ($(this).val() == "") { $(this).focus(); flag = false; } });
                return flag;
            });
        });
    </script>
</asp:Content>
